package com.zxy.servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;

import java.io.IOException;
@WebServlet("/servlet4")
public class servlet4 extends HttpServlet {
    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
//      行相关  GET/POST URL  HTP/1.1
        System.out.println(req.getRequestId());
        System.out.println(req.getLocalPort());

        System.out.println(req.getScheme());// 获取请求协议
        System.out.println(req.getProtocol());//获取请求协议及版本
//        System.out.println(req.getRequestURI());//获取请求的URL，项目资源路径

//        System.out.println(req.getRequestURL());//获取请求的URL,项目内资源的完成的路径
        System.out.println(req.getServerPort());
        System.out.println(req. getRemotePort());

//      头相关  KEY:value

    }
}
